<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html>
<body>
<!-- .box-footer-->
    <div class="pull-left">
        <div class="form-group form-inline">
            总共${pb.pages} 页，共${pb.total} 条数据。 每页
            <select class="form-control" onchange="chagetext(this.value)">
                <option ${pb.pageSize==3?"selected":""}>3</option>
                <option ${pb.pageSize==5?"selected":""}>5</option>
                <option ${pb.pageSize==10?"selected":""}>10</option>
            </select> 条
        </div>
    </div>
    <script>
        function  chagetext(pages) {
            location.href="${param.pageUrl}?pageNum=${pb.pageNum}&pageSize="+pages;
        }
    </script>

    <div class="box-tools pull-right">
        <ul class="pagination">
            <c:if test="${pb.pageNum!=1}">
                <li>
                    <a href="javascript:topage('1','${pb.pageSize}')" aria-label="Previous">首页</a>
                </li>
                <li><a href="javascript:topage('${pb.pageNum-1}','${pb.pageSize}')">上一页</a></li>
            </c:if>
            <c:forEach begin="${pb.navigateFirstPage}" end="${pb.navigateLastPage}" step="1" var="page">
                <li><a href="javascript:topage('${pb.pageNum=page}','${pb.pageSize}')">${page}</a></li>
            </c:forEach>
            <c:if test="${pb.pageNum!=pb.pages}">
                <li><a href="javascript:topage('${pb.pageNum+1}','${pb.pageSize}')">下一页</a></li>
                <li>
                    <a href="javascript:topage('${pb.pageNum=pages}','${pb.pageSize}')" aria-label="Next">尾页</a>
                </li>
            </c:if>
        </ul>
    </div>

<form id="formId" action="${param.pageUrl}" method="post">
    <input type="hidden" name="pageNum"  id="pageNum">
    <input type="hidden" name="pageSize"  id="pageSize">
</form>
<script>
    function topage(pageNum,pageSize){
        // 获取每次传递的当前页
        $("#pageNum").val(pageNum);
        $("#pageSize").val(pageSize);
        // 让表单提交
        $("#formId").submit();
    }
</script>
</body>
</html>
